package top.laoshuzi.designpatterns.base.behavior.mediator;

import org.junit.Test;

public class Client {

    @Test
    public void operation() {

        Colleage colleageA = new ConcreteColleageA();
        Colleage colleageB = new ConcreteColleageB();
        Colleage colleageC = new ConcreteColleageC();

        Mediator mediator = new ConcreteMediator(colleageA, colleageB, colleageC);

        colleageA.setValueByAffect(mediator, 5);
        System.out.println(colleageA.toString());
        System.out.println(colleageB.toString());
        System.out.println(colleageC.toString());

        colleageB.setValueByAffect(mediator, 5);
        System.out.println(colleageA.toString());
        System.out.println(colleageB.toString());
        System.out.println(colleageC.toString());

        colleageC.setValueByAffect(mediator, 5);
        System.out.println(colleageA.toString());
        System.out.println(colleageB.toString());
        System.out.println(colleageC.toString());
    }
}
